package cn.stylefeng.guns.modular.business.frequency.syssitecity.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.syssitecity.service.SiteCityService;
import cn.stylefeng.guns.modular.business.frequency.syssitecity.model.param.SysSiteCityParam;

import javax.annotation.Resource;

/**
 * sys_site_city 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:17
 */
@RestController
public class SysSiteCityController {

    @Resource
    private SiteCityService sysSiteCityService;

    /**
     * 分页查询sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/siteCity/page")
    @BusinessLog(title = "sys_site_city_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(SysSiteCityParam sysSiteCityParam) {
        return new SuccessResponseData(sysSiteCityService.page(sysSiteCityParam));
    }

    /**
     * 获取全部sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/siteCity/list")
    @BusinessLog(title = "sys_site_city_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(SysSiteCityParam sysSiteCityParam) {
        return new SuccessResponseData(sysSiteCityService.list(sysSiteCityParam));
    }

    /**
     * 查看详情sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @GetMapping("/siteCity/detail")
    @BusinessLog(title = "sys_site_city_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(SysSiteCityParam.detail.class) SysSiteCityParam sysSiteCityParam) {
        return new SuccessResponseData(sysSiteCityService.detail(sysSiteCityParam));
    }

    /**
     * 添加sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/siteCity/add")
    @BusinessLog(title = "sys_site_city_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(SysSiteCityParam.add.class) SysSiteCityParam sysSiteCityParam) {
        sysSiteCityService.add(sysSiteCityParam);
        return new SuccessResponseData();
    }

    /**
     * 删除sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/sysSiteCity/delete")
    @BusinessLog(title = "sys_site_city_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(SysSiteCityParam.delete.class) SysSiteCityParam sysSiteCityParam) {
        sysSiteCityService.delete(sysSiteCityParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑sys_site_city
     *
     * @author yujie
     * @date 2023/05/09 17:17
     */
    @PostMapping("/sysSiteCity/edit")
    @BusinessLog(title = "sys_site_city_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(SysSiteCityParam.edit.class) SysSiteCityParam sysSiteCityParam) {
        sysSiteCityService.edit(sysSiteCityParam);
        return new SuccessResponseData();
    }


}
